// MESSAGE SATS_REQUEST support class

#pragma once

namespace mavlink {
namespace fppa {
namespace msg {

/**
 * @brief SATS_REQUEST message
 *
 * Request the params of satellite
 */
struct SATS_REQUEST : mavlink::Message {
    static constexpr msgid_t MSG_ID = 175;
    static constexpr size_t LENGTH = 108;
    static constexpr size_t MIN_LENGTH = 108;
    static constexpr uint8_t CRC_EXTRA = 239;
    static constexpr auto NAME = "SATS_REQUEST";


    uint8_t cmd; /*<  the params of cmd. */
    uint32_t sat_id; /*<   sat_id. */
    std::array<uint8_t, 64> name; /*<   satellite name. */
    float slon; /*<  satellite longitude. */
    float llon; /*<  local longitude */
    float llat; /*<  local latitude. */
    uint8_t auto_gps; /*<  auto gps. */
    uint8_t beacon; /*<   beacon mode. */
    float down_freq; /*<  down frequency(MHz). */
    float down_symb; /*<  down symb. */
    float down_polar; /*<  down polar. */
    float up_freq; /*<  up frequency(MHz). */
    float up_polar; /*<  up polar. */
    float res1; /*<  res1. */
    uint8_t res2; /*<  res2. */


    inline std::string get_name(void) const override
    {
            return NAME;
    }

    inline Info get_message_info(void) const override
    {
            return { MSG_ID, LENGTH, MIN_LENGTH, CRC_EXTRA };
    }

    inline std::string to_yaml(void) const override
    {
        std::stringstream ss;

        ss << NAME << ":" << std::endl;
        ss << "  cmd: " << +cmd << std::endl;
        ss << "  sat_id: " << sat_id << std::endl;
        ss << "  name: [" << to_string(name) << "]" << std::endl;
        ss << "  slon: " << slon << std::endl;
        ss << "  llon: " << llon << std::endl;
        ss << "  llat: " << llat << std::endl;
        ss << "  auto_gps: " << +auto_gps << std::endl;
        ss << "  beacon: " << +beacon << std::endl;
        ss << "  down_freq: " << down_freq << std::endl;
        ss << "  down_symb: " << down_symb << std::endl;
        ss << "  down_polar: " << down_polar << std::endl;
        ss << "  up_freq: " << up_freq << std::endl;
        ss << "  up_polar: " << up_polar << std::endl;
        ss << "  res1: " << res1 << std::endl;
        ss << "  res2: " << +res2 << std::endl;

        return ss.str();
    }

    inline void serialize(mavlink::MsgMap &map) const override
    {
        map.reset(MSG_ID, LENGTH);

        map << sat_id;                        // offset: 0
        map << slon;                          // offset: 4
        map << llon;                          // offset: 8
        map << llat;                          // offset: 12
        map << down_freq;                     // offset: 16
        map << down_symb;                     // offset: 20
        map << down_polar;                    // offset: 24
        map << up_freq;                       // offset: 28
        map << up_polar;                      // offset: 32
        map << res1;                          // offset: 36
        map << cmd;                           // offset: 40
        map << name;                          // offset: 41
        map << auto_gps;                      // offset: 105
        map << beacon;                        // offset: 106
        map << res2;                          // offset: 107
    }

    inline void deserialize(mavlink::MsgMap &map) override
    {
        map >> sat_id;                        // offset: 0
        map >> slon;                          // offset: 4
        map >> llon;                          // offset: 8
        map >> llat;                          // offset: 12
        map >> down_freq;                     // offset: 16
        map >> down_symb;                     // offset: 20
        map >> down_polar;                    // offset: 24
        map >> up_freq;                       // offset: 28
        map >> up_polar;                      // offset: 32
        map >> res1;                          // offset: 36
        map >> cmd;                           // offset: 40
        map >> name;                          // offset: 41
        map >> auto_gps;                      // offset: 105
        map >> beacon;                        // offset: 106
        map >> res2;                          // offset: 107
    }
};

} // namespace msg
} // namespace fppa
} // namespace mavlink
